package utils;

import javax.swing.*;
import java.awt.*;

public class Images {
    /*声明图片资源*/
    public static Image BLUEFireball;//自瞄道具图片
    public static Image background;//背景图片
    public static Image gameStart;//开始图片
    public static Image lifeProps;//血量道具当前帧
    public static Image startGame;//开始游戏图片
    public static Image gameOver;//游戏结束图片
    public static Image skeleton;//骷髅怪当前帧
    public static Image fireball;//火球当前帧
    public static Image autoFireball;//火球当前帧
    public static Image ground;//地面图片
    public static Image choose;//选择界面图片
    public static Image iceBG;//冰冻画面
    public static Image blast;//爆炸动画当前帧
    public static Image bird;//小鸟当前帧
    public static Image rIs;//r技能准备好的图像
    public static Image rNo;//r技能没有准备好的图像
    public static Image suspend;//游戏暂停时显示的图标
    public static Image pause;//游戏进行时显示的图标，按下图标则暂停游戏

    /*图片数组*/
    public static Image[] autoFireballImages = new Image[30];
    public static Image[] fireballImages = new Image[30];
    public static Image[] skeletonImages = new Image[18];
    public static Image[] lifePropsImages = new Image[8];
    public static Image[] blueFireball = new Image[6];
    public static Image[] birdImages = new Image[8];
    public static Image[] blastImages = new Image[8];
    public static Image[] difficulty = new Image[3];
    public static Image[] birdFlash = new Image[8];
    public static Image[] columns = new Image[2];
    public static Image[] HP = new Image[4];
    public static Image[] MP = new Image[6];


    /*初始化图片资源*/
    static {
        BLUEFireball = new ImageIcon("./resources/Images/autoFireballImages/af0.png").getImage();
        lifeProps = new ImageIcon("./resources/Images/lifePropsImages/lifeProps0.png").getImage();
        columns[0] = new ImageIcon("./resources/Images/basicImages/columnUp.png").getImage();
        columns[1] = new ImageIcon("./resources/Images/basicImages/columnDown.png").getImage();
        skeleton = new ImageIcon("./resources/Images/skeletonImages/skeleton0.png").getImage();
        startGame = new ImageIcon("./resources/Images/basicImages/startGame.png").getImage();
        gameStart = new ImageIcon("./resources/Images/basicImages/gameStart.png").getImage();
        fireball = new ImageIcon("./resources/Images/fireballImages/fireball0.png").getImage();
        autoFireball= new ImageIcon("./resources/Images/autoFireballImages/af0.png").getImage();
        gameOver = new ImageIcon("./resources/Images/basicImages/gameOver.png").getImage();
        background = new ImageIcon("./resources/Images/basicImages/bg.png").getImage();
        ground = new ImageIcon("./resources/Images/basicImages/ground.png").getImage();
        suspend = new ImageIcon("./resources/Images/basicImages/goOn.png").getImage();
        pause = new ImageIcon("./resources/Images/basicImages/button_pause.png").getImage();

        choose = new ImageIcon("./resources/Images/basicImages/choose.png").getImage();
        iceBG = new ImageIcon("./resources/Images/basicImages/iceBG.png").getImage();
        blast = new ImageIcon("./resources/Images/blastImages/blast0.png").getImage();
        bird = new ImageIcon("./resources/Images/birdImages/0.png").getImage();
        rIs = new ImageIcon("./resources/Images/basicImages/Ris.png").getImage();
        rNo = new ImageIcon("./resources/Images/basicImages/Rno.png").getImage();


        for (int i = 0; i < birdImages.length; i++) {
            birdImages[i] = new ImageIcon("./resources/Images/birdImages/" + i + ".png").getImage();
        }

        for (int i = 0; i < birdFlash.length; i++) {
            if (i % 2 == 0) {
                birdFlash[i] = new ImageIcon("./resources/Images/birdImages/" + i + ".png").getImage();
            } else {
                birdFlash[i] = new ImageIcon("./resources/Images/birdImages/blankBird.png").getImage();
            }
        }

        for (int i = 0; i < HP.length; i++) {
            HP[i] = new ImageIcon("./resources/Images/HPImages/" + i + "HP.png").getImage();
        }

        for (int i = 0; i < fireballImages.length; i++) {
            fireballImages[i] = new ImageIcon("./resources/Images/fireballImages/fireball" + i + ".png").getImage();
        }

        for (int i = 0; i < skeletonImages.length; i++) {
            skeletonImages[i] = new ImageIcon("./resources/Images/skeletonImages/skeleton" + i + ".png").getImage();
        }

        for (int i = 0; i < difficulty.length; i++) {
            difficulty[i] = new ImageIcon("./resources/Images/basicImages/difficulty" + i + ".png").getImage();
        }

        for (int i = 0; i < lifePropsImages.length; i++) {
            lifePropsImages[i] = new ImageIcon("./resources/Images/lifePropsImages/lifeProps" + i + ".png").getImage();
        }

        for (int i = 0; i < MP.length; i++) {
            MP[i] = new ImageIcon("./resources/Images/MPImages/MP" + i + ".png").getImage();
        }

        for (int i = 0; i < autoFireballImages.length; i++) {
            autoFireballImages[i] = new ImageIcon("./resources/Images/autoFireballImages/af" + i + ".png").getImage();
        }
        for (int i = 0; i < blueFireball.length; i++) {
            blueFireball[i] = new ImageIcon("./resources/Images/blueFireball/a" + i + ".png").getImage();
        }

        for (int i = 0; i < blastImages.length; i++) {
            blastImages[i] = new ImageIcon("./resources/Images/blastImages/blast" + i + ".png").getImage();
        }
    }

}
